#ifndef RTW_HEADER_Balance_h_
#define RTW_HEADER_Balance_h_
#ifndef Balance_COMMON_INCLUDES_
#define Balance_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif

#include "Balance_types.h"

#include "calPrms.h"

#include "Rte.h"

typedef struct {
  boolean_T Flag_Balance[32];
} B_Balance_c_T;

typedef struct {
  uint32_T UnitDelay_DSTATE;
  uint32_T Local_State;
  uint8_T is_c3_Balance;
  uint8_T Count;
  uint8_T Count_Flag;
  uint8_T is_active_c3_Balance;
  uint8_T is_active_c1_Balance;
  boolean_T Relay1_Mode;
  boolean_T Relay2_Mode;
  boolean_T Relay_Mode;
} DW_Balance_f_T;

struct tag_RTM_Balance_T {
  const char_T **errorStatus;
};

typedef struct {
  B_Balance_c_T rtb;
  DW_Balance_f_T rtdw;
  RT_MODEL_Balance_T rtm;
} MdlrefDW_Balance_T;

extern void Balance_initialize(const char_T **rt_errorStatus, RT_MODEL_Balance_T
  *const Balance_M);
extern void Balance(const boolean_T *rtu_Balance_Ena, const uint16_T
                    rtu_Cell_Voltage_mV[32], const uint16_T *rtu_CellV_min,
                    const uint16_T *rtu_CellV_max, const int16_T *rtu_CellT_Max,
                    const int16_T *rtu_CellT_Min, const int16_T *rtu_PCB_T_Max,
                    const int16_T *rtu_PCB_T_Min, const uint8_T
                    *rtu_CollectChip_Temperature_Fla, const boolean_T
                    *rtu_Flag_Charge, const uint8_T *rtu_Flag_Communication,
                    const real32_T *rtu_SOC_ACT, const uint8_T *rtu_Bala_Diag,
                    const uint32_T *rtu_Balance_State, const boolean_T
                    rtu_CellVConnect_flg[32], uint8_T *rty_Bal_State, uint8_T
                    rty_Flag_Balance[32], uint32_T *rty_EN_Balance,
                    B_Balance_c_T *localB, DW_Balance_f_T *localDW);

#endif

